<style>
    #content #valueSearch {
        padding: 10px;
    }
    #content #keySearch {
        width: 150px;
        padding: 9px;
    }
</style>
<div class="onecolumn">
    <div class="header">
        <span style="color: red; text-align: center; font-weight: bold;">Tìm bạn đọc</span>
    </div>
    <br class="clear"/>
    <div id="content" style="margin-bottom: 20px;">
        <?php
        $form = $this->form;
        $form->setAttribute('action', $this->url('search-reader/default', array('action' => 'index',)));
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <p style="float:left; margin-right: 10px;">
            <?php
            echo $this->formRow($form->get('keySearch'));
            ?>
        </p>
        <p style="float: left; margin-right: 10px;">
            <?php
            echo $this->formInput($form->get('valueSearch'));
            ?>
        </p>
        <p>
            <?php
            echo $this->formInput($form->get('search'));
            ?>

        </p>   
        <div class="viewMessae" style="text-align: center">
            <?php
            if (isset($myMessage)) {
                foreach ($myMessage as $key => $message) {
                    if ($message == "inputError")
                        echo '<span style="color:red;font-weight:bold;float:right;margin-right:550px;margin-top:10px;">Bạn chưa chọn kiểu tìm kiếm</span><br/>';
                    if ($message == "notFoundResult")
                        echo '<span style="color:red;font-weight:bold;float:right;margin-right:550px;margin-top:10px;">Không tìm thấy kết quả nào</span><br/>';
                }
            }
            ?>
        </div>
        <?php
        echo $this->form()->closeTag($form);
        ?>
    </div>
</div>
<?php // if (isset($paginator) && $paginator != null) : ?>
<div class="onecolumn">
    <div class="header">
        <span style="color: red;">Danh sách bạn đọc tìm được</span>
    </div>
    <br class="clear"/>
    <div class="content">
        <form id="form_data" name="form_data" action="" method="post">
            <table class="data" width="100%" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th>
                            <input type="checkbox" id="check_all" name="check_all"/>
                        </th>
                        <th style="width:8%">Mã thẻ</th>
                        <th style="width:15%">Họ tên</th>
                        <th style="width:10%">Năm sinh</th>
                        <th style="width:10%">Đơn vị/Khoa</th>
                        <th style="width:11%">Ngày tạo</th>
                        <th style="width:10%">Ngày hết hạn</th>
                        <th style="width:10%">Tổng số mượn</th>
                        <th style="width:11%">Tình trạng lưu thông</th>
                        <th style="width:15%">Thao tác</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($paginator as $row) : ?>
                        <tr>
                            <td>
                                <input type="checkbox"/>
                            </td>
                            <td><?php echo $this->escapeHtml($row->cardBarcode); ?></td>
                            <td>
                                <?php
                                $cardBarcode = str_replace('.', '-', $row->cardBarcode);
                                ?>
                                <a href="<?php echo $this->url('list-reader/default', array('action' => 'detailReader', 'id' => $cardBarcode)) ?>">
                                    <?php echo $this->escapeHtml($row->fullName); ?>
                                </a>
                            </td>
                            <td><?php echo $this->escapeHtml($row->birthday); ?></td>
                            <td><?php echo $this->escapeHtml($row->className) . '-' . $this->escapeHtml($row->facultyName); ?></td>
                            <td><?php echo $this->escapeHtml($row->dateCreated); ?></td>
                            <td><?php echo $this->escapeHtml($row->dateExpiry); ?></td>
                            <td><?php echo $this->escapeHtml($row->totalBorrow); ?></td>
                            <td>
                                <?php if ($row->isActive): ?>
                                    <a href=""><img src=<?php echo $this->basePath() . '/img/icon_accept.png' ?> alt="delete" class="help" title="Ngừng lưu thông"/></a>
                                <?php else: ?>
                                    <a href=""><img src=<?php echo $this->basePath() . '/img/icon_delete.png' ?> alt="edit" class="help" title="Lưu thông"/></a>
                                <?php endif; ?>
                            </td>
                            <td>
                                <a href=""><img src=<?php echo $this->basePath() . '/img/add.png' ?> alt="edit" class="help" title="Gia hạn"/></a>
                                <a href="<?php echo $this->url('add-new-reader/default', array('action' => 'editReader', 'id' => $row->userID)) ?>" style="margin-left: 20px;"><img src=<?php echo $this->basePath() . '/img/icon_edit.png' ?> alt="edit" class="help" title="Chỉnh sửa"/></a>
                                <a href="" style="margin-left: 20px;"><img src=<?php echo $this->basePath() . '/img/delete.png' ?> alt="Xóa" class="help" title="Xóa"/></a>
                            </td>
                        </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
            <?php
            // add at the end of the file after the table
            echo $this->paginationControl(
                    // the paginator object
                    $this->paginator,
                    // the scrolling style; see http://zf2.readthedocs.org/en/release-2.1.4/modules/zend.paginator.usage.html#rendering-pages-with-view-scripts
                    'sliding',
                    // the partial to use to render the control
                    array('partial/paginator.phtml', 'Admin'),
                    // the route to link to when a user clicks a control link
                    array(
                'route' => 'search-reader',
                    )
            );
            ?>
        </form>

    </div>
</div>
<?php
// endif; ?>